<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>

<!-- $Id: index.jsp 6 2010-05-17 09:19:49Z telbie $ -->

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Clavid SuisseID OAUTH Java Example</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  </head>

<%
  boolean dataAvailable = false;
  String suisseIdNumber = (String) session.getAttribute("suisseid_number");
  if (suisseIdNumber != null) {
    dataAvailable = true;
  } else {
    suisseIdNumber = "";
  }
  String suisseIdName = (String) session.getAttribute("suisseid_name");
  if (suisseIdName != null) {
    dataAvailable = true;
  } else {
    suisseIdName = "";
  }
  String suisseIdEmail = (String) session.getAttribute("suisseid_email");
  if (suisseIdEmail != null) {
    dataAvailable = true;
  } else {
    suisseIdEmail = "";
  }
  if (dataAvailable) {
    session.removeAttribute("suisseid_number");
    session.removeAttribute("suisseid_name");
    session.removeAttribute("suisseid_email");
  }
%>
  
  <body>
    <h1>Clavid SuisseID OAUTH Java Example</h1>
      <% if (dataAvailable) { %>
        SuisseID Number: <%=suisseIdNumber %><br/>
        SuisseID Name: <%=suisseIdName %><br/>
        SuisseID E-Mail: <%=suisseIdEmail %><br/>
      <% } %>
      <form action="servlet/OAuthSuisseID/request">
        <input type="Submit" value="Trial"/>
      </form>
  </body>
</html>
